package com.toocms.jinjuhang.wxapi;

import com.blankj.utilcode.util.LogUtils;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram;
import com.toocms.jinjuhang.config.Constants;
import com.toocms.tab.bus.Messenger;
import com.toocms.tab.pay.WXPayCallbackActivity;

public class WXPayActivity extends WXPayCallbackActivity {

    @Override
    public void onResp(BaseResp baseResp) {
        if (baseResp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {
            LogUtils.e(baseResp.errCode);
            WXLaunchMiniProgram.Resp launchMiniProResp = (WXLaunchMiniProgram.Resp) baseResp;
            String extraData = launchMiniProResp.extMsg; //对应小程序组件 <button open-type="launchApp"> 中的 app-parameter 属性
            Messenger.getDefault().send(extraData, Constants.MessengerToken.TOKEN_WXPAY_FENGFU_RESPONSE);
        }
        super.onResp(baseResp);
    }
}
